
<!--container begin-->
<script type="text/javascript">

function postqty(qty,th,th_price){

	var old_qty = $("#qty"+th).val();
	
	var current_qty = parseInt(old_qty)+parseInt(qty);

	if(current_qty<1)return;

	$("#qty"+th).val(current_qty);
	
	var tot = current_qty*th_price;
	
	$("#sub_tot_dis"+th).html(tot.toFixed(2));

	$.post("/changeqty",{product_id:th,qty:current_qty},function(msg){

		number = parseInt(msg);

		$("#sub_tot").html(number.toFixed(2));
	  	  
	});

}

function isNumberKey(evt)
{   
	  var charCode = (evt.which) ? evt.which : event.keyCode;
	  if (charCode = 46 && charCode > 31 && (charCode < 48 || charCode > 57))
	  return false;
}

function change_qty(th,th_price)
{	
	var qty=$("#qty"+th).val();
	var tot=qty*th_price;
	$("#sub_tot_dis"+th).html(tot.toFixed(2));
	var qstring = 'qty='+qty+'&product_id='+th;
	$.ajax({  
		type: "POST",  
		url: "/changeqty",  
		data: qstring ,
		success: function(msg){	
		number = msg;		
		$("#sub_tot").html(number.toFixed(2));
		} 
	}); 

}

  </script>




<div id="container" class="fix">
	<div class="icontainer"><div class="crumb">
		<a href="/">Home</a>
		&gt; Shopping Basket
	</div>
		<div class="cartWrapper">
			<div class="cartPro">
				<h3>Shopping Basket</h3>
				<div class="bagArea">
					<div class="itmetotal">
						Your Shopping Basket Contains
						<span><{$data.item}> Item(s)</span>
					</div>
					<table class="cartTable">
						<tr class="title">

							<th class="itemDetail">Product Name</th>

							<th class="bagQty">Qty</th>
							<th class="bagPrice">Price Each</th>
							<th class="totalPrice">Subtotal</th>
							<th class="action">Remove</th>
						</tr>
              <{$subtotal = 0}>
              
              <{if $data.products}>
              <{foreach $data.products as $item}>
              <tr>

							<td class="itemDetail">
								<div class="itemImg">
									<a href="<{$site_url}>product/<{$item.prourl}>">
										<img src="<{$site_url}>img/simg/<{$item.img}>" alt="" width="60" height="60" />
									</a>
								</div>
								<div class="itemText">
									<a href="<{$site_url}>product/<{$item.prourl}>" title=""><{$item.proname}></a>
								</div>
							</td>
				
							
							<td class="bagQty">
								
								<input type="text" id="qty<{$item.pro_id}>" class="qtyInput" size="3" value="<{$item.qty}>" name="" 
								onblur="this.value=!this.value?'0':this.value;" onfocus="if (this.value == '0') {this.value=''}" 
								onkeypress="return isNumberKey(event)" onkeyup="change_qty(<{$item.pro_id}>,<{$item.price}>);"/>
								
							</td>			
							
							<td class="bagPrice color01">$<{$item.price}></td>
							<td class="totalPrice color01">$<span id="sub_tot_dis<{$item.pro_id}>"><{$eachtotal = $item.price*$item.qty}><{$eachtotal}> <{$subtotal = $eachtotal + $subtotal}></span></td>
							<td class="action">
								<a href="/del_from_cart/<{$item.pro_id}>"
									class="del">delete</a>
							</td>
						</tr>
              <{/foreach}>
              <{/if}>           
            </table>

					<form action="/shipaddress" method="post">
						
						<div class="totalArea">
							<p>Basket Subtotal: $<span id="sub_tot"><{$subtotal}></span></p>
						</div>
						<div class="cartBtn fix ">
							<a href="/" class="continueBtn">Continue Shopping</a>
							<input type="submit" class="checkoutBtn"
								value="Proceed to Checkout" <{if $data.item==0}> disabled='disabled' <{/if}>/>
					
					</form>
				</div>
			</div>
		</div>
	</div>

</div>
</div>
<!--container end-->